import Vue from 'vue'
import Vuex from 'vuex'
import http from "../../util/http";
Vue.use(Vuex)

const module = {
  namespaced:true,
  state: {
    detailData:"",
    detailId:''
  },
  mutations: {
    setDetailData(state, detailData) {
      state.detailData = detailData;
    } ,
    setDetailId(state, detailId) {
      state.detailId = detailId;
    }
  },
  //处理异步操作
  actions: {
    //获取详情数据
    getDetailData(store,paramsId){
      http({
        url: `/gateway?filmId=${paramsId}&k=9973554`,
        headers: {
          "X-Host": "mall.film-ticket.film.info",
        },
      }).then((res) => {
        store.commit("setDetailData",res.data.data.film);
      });
    }
  }
}
export default module;